import { defHttp } from '/@/utils/http/axios';
import {resolveWaylineFile} from './file.api.ts';

enum Api {
  query = '/uav/wayline/query',
  get = '/uav/wayline/get',
  del = '/uav/wayline/del',
  save = '/uav/wayline/save',
  upload = '/uav/wayline/upload'
}

export const waylineApi = {
  query: (params) => defHttp.post({ url: Api.query, params }),
  get: (params) => defHttp.get({ url: Api.get, params }),
  del: (params) => defHttp.get({ url: Api.del, params }),
  save: (params) => defHttp.post({url: Api.save, params}),
  resolveFile: (fileUrl, callback) => resolveWaylineFile(fileUrl, callback),
  upload: (params) => defHttp.post({url: Api.upload, params, headers: { "Content-Type": "multipart/form-data" } })
};